﻿<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:dsml="http://www.dsml.org/DSML" xmlns:ms-dsml="http://www.microsoft.com/MMS/DSML">
  <xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes" />
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
          body {
          margin-top: 10px;
          margin-left: 10px;
          margin-right: 10px;
          margin-bottom: 10px;
          }
          table {
          font-family: Tahoma;
          font-size: 11px;
          }
          .datatable {
          font-family: Tahoma;
          font-size: 11px;
          border-top: 1px RGB(212,208,200) solid;
          border-left: 1px RGB(212,208,200) solid;
          border-right: 1px RGB(212,208,200) solid;
          border-bottom: 1px RGB(212,208,200) solid;
          padding: 0px;
          }
          td {
          text-align: center;
          padding-left:10px;
          padding-right:10px;
          }
          th {
          background:#CCCCCC;
          border-right: #666666 1px solid;
          border-bottom: #666666 1px solid;
          padding-left:10px;
          padding-right:10px;
          }
          .attribute {
          background:#CCCCCC;
          border-right: #666666 1px solid;
          border-bottom: #666666 1px solid;
          padding-left:10px;
          padding-right:10px;
          }
          .section1 {
          padding-top: 10px;
          padding-bottom: 10px;
          padding-left: 10px;
          padding-right: 10px;
          font-weight: bold;
          background: rgb(234,242,255);
          border-bottom: 1px solid rgb(120,172,255);
          }
          .section2 {
          text-align:left;
          border-bottom: green 1px solid;
          padding-bottom: 5px;
          padding-left: 10px;
          padding-right: 10px;
          background: #e9ffcb;
          font-weight: bold;
          padding-top: 5px
          }
          .section3 {
          font-weight: bolder;
          padding-left: 10px;
          padding-top: 10px;
          }

          .headleft {
          text-align: left;
          padding-left: 10px;
          padding-right: 5px;
          padding-top: 2px;
          padding-bottom: 2px;
          font-weight: normal;
          white-space: nowrap;
          background-color: RGB(212,208,200);
          }
          .headcenter {
          text-align: center;
          padding-left: 10px;
          padding-right: 5px;
          padding-top: 2px;
          padding-bottom: 2px;
          font-weight: normal;
          white-space: nowrap;
          background-color: RGB(212,208,200);
          }
          .leftdata {
          padding-left: 10px;
          padding-right: 10px;
          white-space: nowrap;
          font-weight: normal;
          text-align: left;

          }
          .centerdata {
          padding-left: 10px;
          padding-right: 10px;
          white-space: nowrap;
          text-align: center;
          font-weight: normal;
          }
        </style>
        <title>Metaverse Active Schema Configuration</title>
      </head>
      <body>
        <table class="datatable" id="curdata" name="curdata">
          <tr>
            <td class="section1" colspan="5">
              <xsl:text>Metaverse Active Schema Configuration</xsl:text>
            </td>
          </tr>
          <xsl:for-each select="//import-flow-set">
            <tr>
              <td class="section2" colspan="5">
                <xsl:text>Metaverse object type: </xsl:text>
                <xsl:value-of select="@mv-object-type" />
              </td>
            </tr>
            <tr>
              <th>Metaverse Attribute</th>
              <th>Type</th>
              <th>Multi-valued</th>
              <th>Indexed</th>
              <th>Import-Flows</th>
            </tr>
            <xsl:for-each select="import-flows">
              <tr>
                <xsl:variable name="mv-attribute" select="@mv-attribute" />
                <td class="centerdata">
                  <xsl:value-of select="$mv-attribute" />
                </td>

                <td class="centerdata">
                  <xsl:variable name ="oid"  select="//dsml:attribute-type[@id=$mv-attribute]/dsml:syntax" />
                  <xsl:choose>
                    <xsl:when test="$oid='1.3.6.1.4.1.1466.115.121.1.27'" >
                      <xsl:text>Number</xsl:text>
                    </xsl:when>
                    <xsl:when test="$oid='1.3.6.1.4.1.1466.115.121.1.12'" >
                      <xsl:text>Reference (DN)</xsl:text>
                    </xsl:when>
                    <xsl:when test="$oid='1.3.6.1.4.1.1466.115.121.1.7'" >
                      <xsl:text>Boolean</xsl:text>
                    </xsl:when>
                    <xsl:when test="$oid='1.3.6.1.4.1.1466.115.121.1.5'" >
                      Binary
                     <xsl:call-template name="isindexable" />
                    </xsl:when>
                    <xsl:when test="$oid='1.3.6.1.4.1.1466.115.121.1.15'" >
                      String
                      <xsl:call-template name="isindexable" />
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="$oid" />
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
                <td>
                  <xsl:choose>
                    <xsl:when test="//dsml:attribute-type[@id=$mv-attribute]/@single-value">
                      <xsl:choose>
                        <xsl:when test="//dsml:attribute-type[@id=$mv-attribute]/@single-value='true'">
                          no
                        </xsl:when>
                        <xsl:otherwise>yes</xsl:otherwise>
                      </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>yes</xsl:otherwise>
                  </xsl:choose>
                </td>
                <td>
                  <xsl:choose>
                    <xsl:when test="//dsml:attribute-type[@id=$mv-attribute]/@ms-dsml:indexed">
                      <xsl:choose>
                        <xsl:when test="//dsml:attribute-type[@id=$mv-attribute]/@ms-dsml:indexed='true'">
                          yes
                        </xsl:when>
                        <xsl:otherwise>no</xsl:otherwise>
                      </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>no</xsl:otherwise>
                  </xsl:choose>
                </td>
                <td>
                  <xsl:value-of select="count(import-flow)"/>
                </td>
              </tr>
            </xsl:for-each>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
  <!--===================================================================================================================================-->
  <!-- Template to determine whether a value is indexable                                                                                -->
  <!--===================================================================================================================================-->
  <xsl:template name="isindexable">
    <xsl:param name="value" />
    <xsl:choose>
      <xsl:when test="//dsml:attribute-type[@id=$value]/@ms-dsml:indexable='true'" >
        <xsl:text> (indexable)</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text> (non-indexable)</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
